/* Sentinel - IRC Statistical and Operator Services
** configparse.h - A modified version of csircd's configuration file parser
**
** Copyright W. Campbell and others.  See README for more details
** Some code Copyright: Jonathan George, Kai Seidler, ircd-hybrid Team,
**                      IRCnet IRCD developers.
**
** $Id: configparse.h,v 1.1 2003/11/07 13:09:40 wcampbel Exp $
*/

/* Original Header: */

/*
**   Generic Config file parser (configparse.h)
**   Copyright (C) 1999 Fred Jacobs, Chris Behrens
**
**   This program is free software; you can redistribute it and/or modify
**   it under the terms of the GNU General Public License as published by
**   the Free Software Foundation; either version 1, or (at your option)
**   any later version.
**
**   This program is distributed in the hope that it will be useful,
**   but WITHOUT ANY WARRANTY; without even the implied warranty of
**   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
**   GNU General Public License for more details.
**
**   You should have received a copy of the GNU General Public License
**   along with this program; if not, write to the Free Software
**   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

/*
**  The idea of something this generic came solely from Fred Jacobs.
**  I completely rewrote his implementation, however, although some
**  pieces remain similar.  Thank you very much, Fred! :)
**    - Chris
*/

#ifndef __CONFPARSE_H__
#define __CONFPARSE_H__

typedef struct _configfile	CONFIGFILE;
typedef struct _configentry	CONFIGENTRY;

struct _configfile
{
  char	*cf_filename;
  CONFIGENTRY	*cf_entries;
  CONFIGFILE	*cf_next;
};

struct _configentry
{
  CONFIGFILE	*ce_fileptr;

  int	ce_varlinenum;
  char	*ce_varname;
  char	*ce_vardata;
  int	ce_vardatanum;
  int	ce_fileposstart;
  int	ce_fileposend;

  int	ce_sectlinenum;
  CONFIGENTRY	*ce_entries;

  CONFIGENTRY	*ce_prevlevel;

  CONFIGENTRY	*ce_next;
};

void config_free(CONFIGFILE *cfptr);
CONFIGFILE *config_load(char *filename);
CONFIGENTRY *config_find(CONFIGENTRY *ceptr, char *name);

#endif
